UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NQCY+ENG1ni/zRJ5NlkyD8Z5z84VUKa7+BjvKeUBtYo=' 
WHERE 
  key_id = '4aadfe1a99b133408b0df4ea9340aadebfe291a712ae43fc48fcf3a4a4a08ad5' 
  AND (
    token = 'NQCY+ENG1ni/zRJ5NlkyD8Z5z84VUKa7+BjvKeUBtYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030