UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'os7yWp8dMjcgX1k3LZS0bQ306vKThQkdw750+n69q3s=' 
WHERE 
  key_id = 'a54546509e2059f481b5502f375e441e8cfd255554a4491d2a5a79780869a1de' 
  AND (
    token = 'os7yWp8dMjcgX1k3LZS0bQ306vKThQkdw750+n69q3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031