UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LF97lZcYPys7EXspa8tBA+K0f5BNVVaaMLQfQdo03XI=' 
WHERE 
  key_id = '2e70d2fbce3994de016b610ebba76b8ef375c2a04a4c31663dfb81d65fc60445' 
  AND (
    token = 'LF97lZcYPys7EXspa8tBA+K0f5BNVVaaMLQfQdo03XI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028