UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CQRuYh4mj+gK4f0lO2Ut7MLDvGgqDqiT4lKjKYF09yk=' 
WHERE 
  key_id = '1b8f1a1944348a4bfb67bea4c197dd90f773be3e613f96653243d653734a8164' 
  AND (
    token = 'CQRuYh4mj+gK4f0lO2Ut7MLDvGgqDqiT4lKjKYF09yk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042