UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HyLELZ/XbcKjHFFhe2DGcTnAgs0KbpCALcD6r5vUohs=' 
WHERE 
  key_id = '44f423ec16c611e9c27d9396c54631831f89476421c04c33c15454abed98cfb2' 
  AND (
    token = 'HyLELZ/XbcKjHFFhe2DGcTnAgs0KbpCALcD6r5vUohs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038