UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D5kp1mpNTH32yvvS8Zp0Lm7kQhhRyFpH+bBSd0rUA9g=' 
WHERE 
  key_id = '44817daa8057251801c440dade464d2d1f81fd784c60559ca590f23c1cc48d53' 
  AND (
    token = 'D5kp1mpNTH32yvvS8Zp0Lm7kQhhRyFpH+bBSd0rUA9g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020