UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BA4Sq7I4zR4q9C2vO8oN7Jx3Xk+VtyBPcBAZOIwW5KA=' 
WHERE 
  key_id = '04cb138d12083fdb0e045d3cadca2ad52cbbb643239c3e705ff973a84d31de76' 
  AND (
    token = 'BA4Sq7I4zR4q9C2vO8oN7Jx3Xk+VtyBPcBAZOIwW5KA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019