UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'teyP+bkcZw5d/7yqStYc0TJCkGWeDA23SbWH6V8Q7DM=' 
WHERE 
  key_id = '6db995e35fee5d8d7e39aec2dee25758dfd3f86ffe7b00e9fab7a9b4613123a0' 
  AND (
    token = 'teyP+bkcZw5d/7yqStYc0TJCkGWeDA23SbWH6V8Q7DM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038