UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uwtNX+9pRdVTuyBkr6W2fo3TZx7Lq4ldpku9ZogyHrI=' 
WHERE 
  key_id = 'ba57937f1ba1c50b3fbcc8a520325d2f4c9e5407aa22ad153587b41d4cba868f' 
  AND (
    token = 'uwtNX+9pRdVTuyBkr6W2fo3TZx7Lq4ldpku9ZogyHrI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039