UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bn18q9Z37OYvQpSNmZOqJi7TMo/rrIPgChjSjUuLgvs=' 
WHERE 
  key_id = '86f543213461ede34e39c248cc157133c6ff2631ef62fedb9109761e8e68c43c' 
  AND (
    token = 'Bn18q9Z37OYvQpSNmZOqJi7TMo/rrIPgChjSjUuLgvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034