UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A/4FsI0VYeHwqwFCjoQHIWj2qSzjn4oU/BQV61snhMY=' 
WHERE 
  key_id = '01a85270cefb5b6837123f619443b97c89884430bf0169e042630f67f326f819' 
  AND (
    token = 'A/4FsI0VYeHwqwFCjoQHIWj2qSzjn4oU/BQV61snhMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025