UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DIT39QfTrklkxSr4Gf7kqvlOoXDR1ccysKfTOagdec8=' 
WHERE 
  key_id = '756578c925c182a6baeab62c7c2d647404feac28596ca8f37f4a8d7a7aa66628' 
  AND (
    token = 'DIT39QfTrklkxSr4Gf7kqvlOoXDR1ccysKfTOagdec8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045