UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YrF8NuXDTHBCBo6nY80usJ2e1Qnjwpuo7efmn6Dxcsw=' 
WHERE 
  key_id = '8d4c196f57e94154b5fabdf2fca91b4f7d33617beb8964b8b3555e3529875ad7' 
  AND (
    token = 'YrF8NuXDTHBCBo6nY80usJ2e1Qnjwpuo7efmn6Dxcsw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030