UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cqdocA6ZvojJ6zb83U6qLPgTvIvmsYM5T4lxdQLI0DY=' 
WHERE 
  key_id = 'adb9b8762c0fe54b28d5a815d9566334d819720aafc1d349fe955f3c2a11958b' 
  AND (
    token = 'cqdocA6ZvojJ6zb83U6qLPgTvIvmsYM5T4lxdQLI0DY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032