UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hEXEtSb2poT6gO78ZFn/A15ciKmNZSO8IEbC+rrTcc8=' 
WHERE 
  key_id = '52946ed68b86d99b751d2c1340785d942fa0a8dd5695230924b8a926d51e2dde' 
  AND (
    token = 'hEXEtSb2poT6gO78ZFn/A15ciKmNZSO8IEbC+rrTcc8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029