UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DMhYqwWRH5TRepr8S6QjRyApU8/mNJHh+28hjgnZ+x0=' 
WHERE 
  key_id = '6a8af97c0f416d8405c514f41673147a0491743d45eb096a010a15c4792809c0' 
  AND (
    token = 'DMhYqwWRH5TRepr8S6QjRyApU8/mNJHh+28hjgnZ+x0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026