UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tmUTafWfIAvw4Y0uKIqzQ5TwiBUdYp8zff52B1CPudg=' 
WHERE 
  key_id = 'efd1b3ab840114d93d72751a77d87b1fe5de217624b74cbe082d876f6c611690' 
  AND (
    token = 'tmUTafWfIAvw4Y0uKIqzQ5TwiBUdYp8zff52B1CPudg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029