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

Query time 0.00030