UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D2UgF/YotA+Nxrg9fDIluIoSz88K8N+QyKGHUnuohws=' 
WHERE 
  key_id = '02441465f9420afac44581008792384386006c9d768c990c50460ccdcc13b3fb' 
  AND (
    token = 'D2UgF/YotA+Nxrg9fDIluIoSz88K8N+QyKGHUnuohws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00078