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

Query time 0.00034