UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a0NCcGRWaIso+WTbhEgVvhl/j15VM0on9WbTmWeq2Tw=' 
WHERE 
  key_id = '99cb88d88953bc98dd073d969428d723df9addef3b1e21f84daf8175b5686fa8' 
  AND (
    token = 'a0NCcGRWaIso+WTbhEgVvhl/j15VM0on9WbTmWeq2Tw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059