UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k0kRPtbMW9umxT2UaeCXXDnP4wxv2WhERf7ZGU7RHGM=' 
WHERE 
  key_id = '580b664ced53290dd0394bac21e4d75fcc133d13977ed2c942f197e63727475b' 
  AND (
    token = 'k0kRPtbMW9umxT2UaeCXXDnP4wxv2WhERf7ZGU7RHGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033