UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q4oEIcLuV8SZtXNfH5S5eqZrAmfATJ3Vq4ww/hek6bw=' 
WHERE 
  key_id = '4c7d2436b662793a8664151d3c468b37ec42a5cd16f30c9229ddea8f2383c161' 
  AND (
    token = 'q4oEIcLuV8SZtXNfH5S5eqZrAmfATJ3Vq4ww/hek6bw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032