UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oukOwer4xBWr5WP8+SlIFz/BsgB63vwfmXj21kqP2ts=' 
WHERE 
  key_id = '34f84a83f8a69b09a5f5d37f03e801f62c7c67d0d5f4eeb9a58c39ef34e0bda1' 
  AND (
    token = 'oukOwer4xBWr5WP8+SlIFz/BsgB63vwfmXj21kqP2ts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031