UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tkuGoT97QlKHQYMGz7ECXIFL+m/xCZ+6uOQDQ7ef+ss=' 
WHERE 
  key_id = 'd569510a3ef133f5e0a09ac35c19e47bb2cebe50869b7a63bce6a34cbfe665ff' 
  AND (
    token = 'tkuGoT97QlKHQYMGz7ECXIFL+m/xCZ+6uOQDQ7ef+ss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028