UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q6AZ+Zwl94jmz+cAz67jilubYzXPchamIp3R6Zxm30k=' 
WHERE 
  key_id = 'a7839e7d25a5918b99fcd3d22b282930bd458906da03f8dd989092c5b55da2f9' 
  AND (
    token = 'Q6AZ+Zwl94jmz+cAz67jilubYzXPchamIp3R6Zxm30k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049