UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KX4F7/LZRzDvS56ssysYJn3Qvg8KeDNfpzS0YHbn0l4=' 
WHERE 
  key_id = '27892817da33b26ecf57082446ab2c07158f5e8f668d4a209ca2373374e327d1' 
  AND (
    token = 'KX4F7/LZRzDvS56ssysYJn3Qvg8KeDNfpzS0YHbn0l4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047