UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YA4VM9taN9OpzOwOx9lG8jnQYdOTi5r/nOBafXmv658=' 
WHERE 
  key_id = 'c6467658f4ecb960b068f63161e501a3d3f94c3164794e29c38e2bb7d8eb5b29' 
  AND (
    token = 'YA4VM9taN9OpzOwOx9lG8jnQYdOTi5r/nOBafXmv658=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043