UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PwrlhwoMUN6MBmouSCRR1Cw29d3EFFjtVDmjqmF68Hs=' 
WHERE 
  key_id = '155a841b2579c4b82f73d583c115eb737789675fdc411234561a93265653cc2d' 
  AND (
    token = 'PwrlhwoMUN6MBmouSCRR1Cw29d3EFFjtVDmjqmF68Hs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046