UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IDfzjGPF/7bfqORScC3V9YDEsRpi2Ewk4Ry2RehGR/g=' 
WHERE 
  key_id = '66483d21a281ec3077d5a66c935242c156abfb523e19768460b886deaeafd9f3' 
  AND (
    token = 'IDfzjGPF/7bfqORScC3V9YDEsRpi2Ewk4Ry2RehGR/g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039