UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'khFo8+4NHpkuPH3sIX46Oty+orE1TQ5l++89l7Hf3Y4=' 
WHERE 
  key_id = 'bc6df4bdf92d15baaecd964696985cb16d4162f6b120fad2ae9626c66b232c50' 
  AND (
    token = 'khFo8+4NHpkuPH3sIX46Oty+orE1TQ5l++89l7Hf3Y4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017