UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rTAbYIDpb/w3clbzPUXsWCMko1c41eHZWA+qe/2hohY=' 
WHERE 
  key_id = 'e549a00309d753a383b534a325ba26c8ec01118e375316dc0217551599195e65' 
  AND (
    token = 'rTAbYIDpb/w3clbzPUXsWCMko1c41eHZWA+qe/2hohY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039