UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aRd0ylVdm1hnQO1enK51MhVPMduvUDtmExxtnDB3+OM=' 
WHERE 
  key_id = 'c555f2af679155acb8601959eb79de07bf17e4667698e8709cc599f670f7f856' 
  AND (
    token = 'aRd0ylVdm1hnQO1enK51MhVPMduvUDtmExxtnDB3+OM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029